from Body.Utility import loadObject
from Cube.game import QObjectBase
# CMDID
from Body.Command import CMD_UP,CMD_DOWN,CMD_LEFT,CMD_RIGHT
# MassBase
from MassBase import MassBase
from pandac.PandaModules import Point2

class Ship(QObjectBase):
    paramDict = dict(
        AccelRation = 10,
        MaxVel = 15,
        TurnRate = 360
    )
    def __init__(self, pos=Point2(0,0)):
        QObjectBase.__init__(self)
        self.ShipModel = loadObject("ship",pos = pos)
        self.Mass = MassBase(self.ShipModel, **Ship.paramDict)
        self.CmdInput = self.Mass.CmdInput
        self.Update = self.Mass.Update

    def PosGet(self):
        pos = self.Mass.Pos
        return pos

    def DoDestroy(self):
        self.Mass.DoDestroy()
        self.ShipModel.removeNode()

